home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 638 b | 38 lines | [TEXT/CWIE] |
- // SimpleConstProxy.h
-
- #ifndef SimpleConstProxy_h
- #define SimpleConstProxy_h
-
- #ifndef Assert_h
- #include "Assert.h"
- #endif
- #ifndef ConstProxy_h
- #include "ConstProxy.h"
- #endif
-
- template < class OwnerType, class StoodFor >
- class SimpleConstProxy: public ConstProxy< StoodFor >
- {
- typedef OwnerType Owner;
- typedef StoodFor (Owner::*Getter)() const;
-
- private:
- const Owner& owner;
- const Getter get;
-
- public:
- SimpleConstProxy( const Owner& theOwner, Getter getter )
- : owner( theOwner ),
- get( getter )
- {
- Assert( getter != 0 );
- }
-
- virtual StoodFor Get() const
- {
- return (owner.*get)();
- }
- };
-
- #endif
-